import subprocess


def main():
    cmd = r'"C:\Program Files\Python310\python.exe" -m pip freeze'
    cmd_std_out = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True)
    std_out, std_err = cmd_std_out.communicate()
    print(111, std_out.decode(),222,  std_err)
if __name__ == '__main__':
    main()